package com.cainaer.orders.api.factory;

import com.cainaer.orders.api.RemoteOrdersService;
import com.cainaer.orders.api.domain.OrderItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import feign.hystrix.FallbackFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * 用户服务降级处理
 * 
 * @author cainaer
 */
@Component
public class RemoteOrdersFallbackFactory implements FallbackFactory<RemoteOrdersService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteOrdersFallbackFactory.class);

    @Override
    public RemoteOrdersService create(Throwable throwable)
    {
        log.error("订单服务调用失败:{}", throwable.getMessage());
        return new RemoteOrdersService()
        {

            @Override
            public Integer selectOrderAmountByShopId(Long shopId) {
                return null;
            }

            @Override
            public List<Long> selectOrderItemProductIdListsByShopId(Long shopId) {
                return null;
            }
        };
    }
}
